#include "kdtree_scene_manager_plugin.h"
#include "OgreRoot.h"

using namespace Ogre; 

namespace fmrt
{
	const String gPluginName = "KD-Tree Scene Manager"; 

	KDTreeSceneManagerPlugin::KDTreeSceneManagerPlugin()
		: m_kdsmFactory(0)
	{
	}
	
	const String KDTreeSceneManagerPlugin::getName() const 
	{
		return gPluginName; 	
	}
	
	void KDTreeSceneManagerPlugin::install()
	{
		// create factory
		m_kdsmFactory = OGRE_NEW KDTreeSceneManagerFactory(); 
	}
	
	void KDTreeSceneManagerPlugin::initialise()
	{
		// Register (factory not dependent on rsys resources)
		Root::getSingleton().addSceneManagerFactory(m_kdsmFactory);
	}
	
	void KDTreeSceneManagerPlugin::shutdown()
	{
		// Unregister SM factory
		Root::getSingleton().removeSceneManagerFactory(m_kdsmFactory);
	}
	
	void KDTreeSceneManagerPlugin::uninstall()
	{
		OGRE_DELETE m_kdsmFactory; 
		m_kdsmFactory = 0; 
	}
	
	
}